package com.fancon.android.gardenjokesx.utils;

import android.content.Context;
import android.content.SharedPreferences;

import com.fancon.android.gardenjokesx.entity.User;

public class UserUtil {

	public static User getInfoUserLogin(Context ctx){
		User user = new User();
		SharedPreferences settings = ctx.getSharedPreferences(
				Constant.PREFS_NAME, 0);
		user.setUser_name(settings.getString(Constant.USER_NAME, ""));
		user.setUser_id(settings.getString(Constant.USER_ID_LOGIN, ""));
		user.setUrl_image(settings.getString(Constant.URL_IMAGE, ""));
		user.setPassword(settings.getString(Constant.PASS, ""));
		user.setCurrent_city(settings.getString(Constant.CITY, ""));
		user.setCurrent_country(settings.getString(Constant.COUNTRY, ""));
		user.setLatE6(settings.getLong(Constant.LAT, 0));
		user.setLonE6(settings.getLong(Constant.LON, 0));
		user.setIs_private(settings.getBoolean(Constant.IS_PRIVATE, false));
		return user;
	}
	public static void logoutUser(Context ctx){
		SharedPreferences settings = ctx.getSharedPreferences(Constant.PREFS_NAME, 0);
		SharedPreferences.Editor edit = settings.edit();
		edit.clear().commit();
	}
	
	
}
